<div class="layui-card">
    <div class="layui-card-header">
        <h2>添加权限</h2>
    </div>
    <div class="layui-card-body">
        <form class="layui-form" action="<?php echo \yii\helpers\Url::to(['create'])?>" method="post">
            <div class="layui-form-item">
                <label for="" class="layui-form-label">上级权限</label>
                <div class="layui-input-inline">
                    <select name="p_name" lay-verify="required">
                            <option value="0">顶级权限</option>
                        <?php foreach ($parent as $p){ ?>
                            <option value="<?php echo $p['name']; ?>"><?php echo $p['description']; ?></option>
                        <?php } ?>
                    </select>
                </div>
                <div class="layui-word-aux layui-form-mid">顶级权限格式：controllerid/*</div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">标识符</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="<?php echo $model->name; ?>" placeholder="请输入标识符"  class="layui-input">
                </div>
                <div class="layui-word-aux layui-form-mid"><?php echo $model->getFirstError('name'); ?></div>
            </div>
            <div class="layui-form-item">
                <label for="" class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="description" value="<?php echo $model->description; ?>" placeholder="请输入名称"  class="layui-input">
                </div>
                <div class="layui-word-aux layui-form-mid"><?php echo $model->getFirstError('description'); ?></div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn">确认</button>
                    <a href="<?php echo \yii\helpers\Url::to(['index']); ?>" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>
    </div>
</div>


<?php
$js = <<<JS
    layui.use(['form','element','table', 'layer'],function() {
        var form = layui.form;  
        var element = layui.element;  
        var table = layui.table;  
        var layer = layui.layer;  
        
    });
JS;
$this->registerJs($js);
